package org.dairy.farms.model;

import org.dairy.farms.interceptor.hibernate.Auditable;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

/**
 * Created by IntelliJ IDEA.
 * User: gduggira
 * Date: Jul 1, 2011
 * Time: 2:56:31 PM
 */
@javax.persistence.Table(name = "FEED_TYPE")
@Entity
public class FeedType implements Auditable {
    
    public static final String REGULAR_GREEN_GRASS="REGULAR_GREEN_GRASS";
    public static final String MINERAL_MIXTURE="MINERAL_MIXTURE";
    public static final String WHEAT_POWDER="WHEAT_POWDER";
    public static final String POWDERS_MIXTURES="POWDERS_MIXTURES";

    @javax.persistence.Column(name = "ID")
    @Id
    @GeneratedValue
    private Long id;

    @javax.persistence.Column(name = "NAME")
    private String name;

    @javax.persistence.Column(name = "DESCRIPTION")
    private String description;

    @OneToMany(mappedBy = "feedType",targetEntity = Feed.class,cascade = CascadeType.ALL,fetch = FetchType.LAZY)
    private Set<Feed> feeds = new HashSet<Feed>();

    @OneToMany(mappedBy = "feedType",targetEntity = LivestockLifeCycleManager.class,cascade = CascadeType.ALL,fetch = FetchType.LAZY)
       private Set<LivestockLifeCycleManager> livestockLifeCycleManagers = new HashSet<LivestockLifeCycleManager>();


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Set<Feed> getFeeds() {
        return feeds;
    }

    public void setFeeds(Set<Feed> feeds) {
        this.feeds = feeds;
    }

    @Embedded
    private AuditInfo auditInfo = new AuditInfo();
    public AuditInfo getAuditInfo() {
        return auditInfo;
    }

    public void setAuditInfo(AuditInfo auditInfo) {
        this.auditInfo = auditInfo;
    }
}
